home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-08-15 | 4.6 KB | 121 lines | [TEXT/CCL2] |
- ;;;
- ;;; object-FDI-drop-glue.lisp
- ;;;
-
- #|
- ================================================================
- Purpose ========================================================
- ================================================================
- Tell object-fred-dialog-items how to start drops. Since
- object-fred-dialog-item is a subclass of fred-dialog-item they already know
- how to receive drops via the code at the bottom of
- object-fred-dialog-item.lisp .
-
-
- ================================================================
- Status =========================================================
- ================================================================
- In-progress.
-
-
- ================================================================
- Change history =================================================
- ================================================================
- 15-Aug-92 mc Created.
-
- |#
-
-
- (in-package "CCL")
-
- (require "OBJECT-DROPPER" "CCL:UMASS Utils;object-dropper")
- (require "OBJECT-FRED-DIALOG-ITEM" "CCL:UMASS Utils;object-fred-dialog-item")
-
-
- ;;;================================================================
- ;;; Tell object-fred-dialog-items how to start and receive drops.
- ;;;================================================================
-
- (defmethod receive-drop ((view object-fred-dialog-item)
- (object t)
- (pt-global integer))
- ;;
- (add-link view object
- (fred-point-position view (global-to-local view pt-global))))
-
-
- (defmethod macptr-region-global ((view object-fred-dialog-item)
- (object t)
- (pt-global-starting integer))
- "Returns a rectangular region that matches view's current selection."
- (declare (optimize speed)
- (ignore object pt-global-starting))
- ;;
- (multiple-value-bind (int-index-selection-start int-index-selection-end)
- (selection-range view)
- (if (= int-index-selection-start int-index-selection-end)
- (call-next-method) ;better choice?
-
- #|;; How to get the selection as a region? Following didn't work:
- ;; Tricky "catching" of the drawing of the selection.
- (let* ((macptr-region-global (#_NewRgn)))
- (#_OpenRgn)
- (set-selection-range view int-index-selection-start int-index-selection-end)
- (fred-update view)
- (#_CloseRgn macptr-region-global)
- macptr-region-global)|#
-
- ;; Return a rectangular region of fixed witdth at the selection's
- ;; start.
- (let* ((macptr-region-global (#_NewRgn))
- (int-pos-horizontal-bottom-start (fred-hpos view int-index-selection-start))
- (int-pos-vertical-start (fred-vpos view int-index-selection-start))
- (int-height-line (- (fred-line-vpos view 1)
- (fred-line-vpos view 0)))
- (int-left int-pos-horizontal-bottom-start)
- (int-right (+ int-left 20))
- (int-bottom int-pos-vertical-start)
- (int-top (- int-bottom int-height-line))
- (pt-top-left (local-to-global view (view-position view))))
- (rlet ((rect :rect :left int-left :top int-top :right int-right
- :bottom int-bottom))
- (#_RectRgn macptr-region-global rect)
- (#_OffsetRgn macptr-region-global (point-h pt-top-left)
- (point-v pt-top-left))
- macptr-region-global)))))
-
-
- ;;; Done.
-
- (provide "OBJECT-FDI-DROP-GLUE")
-
-
- #|
- ;;;
- ;;; Now call evaluate the test code at the bottom of
- ;;; "object-fred-dialog-item.lisp", eval (test-ofdi) and (test-dropper)
- ;;; and drag away. You can use the following:
- ;;;
- ;;; Drag starters: "Test Dropper"'s "Start Tracking" button
- ;;; Any selection in "Test OFDI" window
- ;;;
- ;;; Drag receivers: "Test Dropper"'s "Describe" button
- ;;; "Test OFDI" window
- ;;;
-
- (defmethod view-click-event-handler ((describing-ofdi describing-ofdi)
- where)
- "Implements this dragging policy: if where is in describing-ofdi's
- selection range then calls track-mouse-for-dropping."
- ;;
- (let* ((int-index (fred-point-position describing-ofdi where)))
- (multiple-value-bind (int-index-selection-start int-index-selection-end)
- (selection-range describing-ofdi)
- (if (and (/= int-index-selection-start int-index-selection-end)
- (<= int-index-selection-start int-index int-index-selection-end))
- (track-mouse-for-dropping
- describing-ofdi
- (first (l-str-obj-ofdi-selected describing-ofdi))
- (local-to-global (view-container view) where))
- (call-next-method)))))
- |#